package com.smartstate.gateway.config.properties;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

/**
 * 放行白名单配置
 *
 * @author smartstate
 */
@Configuration
@RefreshScope
@ConfigurationProperties(prefix = "ignore")
public class IgnoreWhiteProperties {
    /**
     * 放行白名单配置，网关不校验此处的白名单
     */
    private List<String> whites = new ArrayList<>();
    private Set<String>  whitsSet = new HashSet<>();

    public List<String> getWhites() {
        return whites;
    }

    public void setWhites(List<String> whites) {
        whitsSet=whites.stream().collect(Collectors.toSet());
        this.whites = whites;
    }

    public Set<String> getWhitsSet() {
        return whitsSet;
    }

    public void setWhitsSet(Set<String> whitsSet) {
        this.whitsSet = whitsSet;
    }
}
